package com.hqyj.server.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.JdbcType;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name="users")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Users extends BaseEntity{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type= IdType.AUTO)
    private Integer uid; //用户的主键自动递增的。
    private String username;
    private String password;

    private String avatar; //用户的头像

    private String introduce; //用户的介绍

    private String tokenName; //登录成功的令牌的名字

    private String tokenValue; //登录成功后的令牌的值

    @Transient //这个字段我不参与持久化...
    @TableField(exist = false,jdbcType = JdbcType.BLOB,typeHandler = FastjsonTypeHandler.class)
    private List<String> roles; //用户的角色集合；


}
